package com.lin.blog.controller;


import com.lin.blog.service.IRolePermissionService;
import com.lin.utils.Result;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lin
 * @since 2020-03-08
 */
@RestController
@RequestMapping("/role_permission")
public class RolePermissionController {

    @Autowired
    private IRolePermissionService rolePermissionService;


    /**
     * 通过主键ID更新RolePermission
     * @param roleId
     * @param permissionList
     * @return
     */
    @ApiOperation("通过主键ID更新RolePermission")
    @ApiImplicitParam(name = "roleId", value = "ID", defaultValue = "0",required = true)
    @PutMapping("/{roleId}")
    public Result updateRolePermission(@PathVariable(value = "roleId",required = true) Long roleId, @RequestBody List<Long> permissionList){

        return rolePermissionService.updateRolePermission(roleId,permissionList);
    }
}
